/*
 * Counter.h
 *
 *  Created on: 24 мая 2022 г.
 *      Author: nikitas
 */

#ifndef COUNTER_H_
#define COUNTER_H_

#include "../Typedefs.h"
#include "../Enums.h"
#include "../STL_includes.h"
#include "../Technical/RuntimeErrorClass.h"
#include "../Technical/Config.h"
#include "SemanticAnalyzer/SemanticAnalyzer.h"


namespace STC_calc{
/*
*	The Counter class contain main functions for
* calculations
*/
class Counter
{
public:
	static const std::map<std::string, Counter_function> function_catalog;
private:
	static const bool is_radian = false;

	/*TODO after making semantic analyzer remove this

	static std::string comma_fix(const std::string& str) noexcept;
	static void check_convert(std::string& str);
	static ldouble_vector convert(const string_vector& args);
	THIS ALL*/

	template <typename T>
	static void check_args_size(const std::vector<T> args, const unsigned long int min);

	static long double count_second_arg(const ldouble_vector args, Counter_function func);
	static void check_denominator(const long double den);

	static std::string trying_to_find_name(const std::string& name);
	static long double veriy_angle(long double radian);

public:
	static bool can_convert(const std::string& str) noexcept;

	static long double set(const ldouble_vector args);

	static long double sum(const ldouble_vector args);
	static long double sum_str(const string_vector args);

	static long double diff(const ldouble_vector args);
	static long double diff_str(const string_vector args);

	static long double mult(const ldouble_vector args);
	static long double mult_str(const string_vector args);

	static long double div(const ldouble_vector args);
	static long double div_str(const string_vector args);

	static long double pow(const ldouble_vector args);
	static long double pow_str(const string_vector args);

	static long double log(const ldouble_vector args);
	static long double log_base(const ldouble_vector args, const long double base);
	static long double log_str(const string_vector args);

	static long double ln(const ldouble_vector args);
	static long double ln_str(const string_vector args);

	static long double lg(const ldouble_vector args);
	static long double lg_str(const string_vector args);

	static long double sin(const ldouble_vector args);
	static long double sin_str(const string_vector args);

	static long double cos(const ldouble_vector args);
	static long double cos_str(const string_vector args);

	static long double tg(const ldouble_vector args);
	static long double tg_str(const string_vector args);

	static long double ctg(const ldouble_vector args);
	static long double ctg_str(const string_vector args);

	static long double exec(Counter_function func, const ldouble_vector args);
	static long double exec(const string_vector args);

	static Counter_function check_func(const std::string& name);
};

}


#endif /* COUNTER_H_ */
